<?php

namespace WebExpres\HotelBundle\Repository;

use Doctrine\ORM\EntityRepository;

class HotelesRepository extends EntityRepository
{
    public function findHotelPare()
    {
        return $this->getEntityManager()
            ->createQuery('SELECT p FROM HotelBundle:Hoteles p Where p.hotelpadre = 1')
            ->getResult();
    }
    
    public function findHotelFills()
    {
        return $this->getEntityManager()
            ->createQueryBuilder('h')
            ->where('h.hotelpadre = 0')
            ->getResult();
    } 
    
    public function isHotelPare($idhotel){
    
        return $this->getEntityManager()
            ->createQuery('SELECT p FROM HotelBundle:Hoteles p Where p.hotelpadre = 1 and p.id = :id')
            ->setParameter('id', $idhotel)
            ->getResult();
        
    }
    
}